#pragma once

#include "type.h"
#include "3rd_part/xml/tinyxml.h"

#include "SceneManager.h"

class TiXmlElement;

namespace ChunkSystem
{
	class Chunk;
	class ChunkItem;
	class ChunkItemFactory;

	//an xml file store chunk infomation including chunk item inside
	class ChunkSceneManager
		:  public RenderSystem::SceneManager
	{
	public:

		enum ChunkItemType
		{
			eModel = 0,
			eSpeedtree,
			eParticles,
			eNavmesh,
			eTerrain,
			eEntity,
			eChunk,
			eEnd
		};

		typedef std::map<String, TiXmlHandle>			MapChunkNodes;
		typedef MapChunkNodes::iterator					ItrMapChunkNodes;

		TiXmlElement* GetChunkRoot( const String& strChunkFilePath ,bool bCreate = true);
		bool CreateChunkItemByType( Chunk* pOwnerChunk, TiXmlElement* pChunkRoot, ChunkItemType eChunkType );

		static String GetTag( ChunkItemType eType );

	private:
		ChunkSceneManager(void);
		~ChunkSceneManager(void);

	private:
		MapChunkNodes	m_ChunkDocNodes;
	};

}